<!DOCTYPE html>
<html  lang="en" xmlns:th="http://www.thymeleaf.org">
<head>


    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>layout 管理系统大布局 - Layui</title>
    <link rel="stylesheet" th:href="@{/libs/layui/css/layui.css}">

    <style>
        #ff{
            height: 260px;

        }
    </style>




</head>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo layui-hide-xs layui-bg-black">校园应用系统</div>

        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-md-inline-block">
                <a href="javascript:;">
                    <img src="//tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" class="layui-nav-img">
                    tester
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="">Your Profile</a></dd>
                    <dd><a href="">Settings</a></dd>
                    <dd><a href="">Sign out</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
                <a href="javascript:;">
                    <i class="layui-icon layui-icon-more-vertical"></i>
                </a>
            </li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">学生管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="/findAll">学生基本信息管理</a></dd>

                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">教室管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="/findAllClassroom">教室信息管理</a></dd>
                    </dl>
                </li>



            </ul>
        </div>
    </div>



    <div class="layui-body">

        <h1>教室管理--修改教室信息</h1>

        <form class="layui-form" action="">

            <input type="hidden" id="pkId" name="pkId" value="${pkId}">

        <div class="layui-form-item">
            <label class="layui-form-label"> 区域</label>
            <div class="layui-input-inline">
                <input type="text" name="area" lay-verify="required" id="area" placeholder="区域" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">楼号</label>
            <div class="layui-input-inline">
                <input type="text" name="buildingNo" lay-verify="required" id="buildingNo"  placeholder="楼号" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">楼层</label>
            <div class="layui-input-inline">
                <input type="text" name="buildingFloor" lay-verify="required" id="buildingFloor"  placeholder="楼层" autocomplete="off" class="layui-input">
            </div>
        </div>

            <div class="layui-form-item">
                <label class="layui-form-label">教室编号</label>
                <div class="layui-input-inline">
                    <input type="text" name="classroomId" lay-verify="required" id="classroomId"  placeholder="教室名称" autocomplete="off" class="layui-input">
                </div>
            </div>



        <div class="layui-form-item">
            <label class="layui-form-label">教室名称</label>
            <div class="layui-input-inline">
                <input type="text" name="classroomName" lay-verify="required" id="classroomName"  placeholder="教室名称" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">容纳人数</label>
            <div class="layui-input-inline">
                <input type="text" name="galleryful" lay-verify="required"  id="galleryful" placeholder="容纳人数" autocomplete="off" class="layui-input">
            </div>
        </div>


            <input type="button" value="保存" class="layui-btn layui-btn-normal" onclick="updateClassroom()"/>
            <input type="button" value="返回" class="layui-btn layui-btn-normal" onclick="history.back(-1)"/>

        </form>

        <script type="text/javascript" th:src="@{/libs/jquery/jquery-3.5.1.js}"></script>
        <script type="text/javascript">



            function updateClassroom (){

                var  pkId=$("#pkId").val();
                var area = $("#area").val();
                var buildingNo = $("#buildingNo").val();
                var buildingFloor = $("#buildingFloor").val();
                var classroomId = $("#classroomId").val();
                var classroomName = $("#classroomName").val();
                var galleryful= $("#galleryful").val();

                var classroom = {
                    "pkId":pkId,
                    "area":area,
                    "buildingNo":buildingNo,
                    "buildingFloor":buildingFloor,
                    "classroomId":classroomId,
                    "classroomName":classroomName,
                    "galleryful":galleryful,
                }

                //2提交servlet   ajax
                $.ajax({
                    type:"post",
                    url:"/classroomUpdate",
                    data:JSON.stringify(classroom),
                    contentType: "application/json;charset=UTF-8",//指定消息请求类型
                    success:function(m){
                        if(m>0){
                            alert("修改信息成功！")
                            location.href="${pageContext.request.contextPath}/classroomTz";
                        }else{
                            alert("修改失败");
                        }
                    },
                    error:function(e){
                        alert("请求错误")
                    }
                })


            }



            $(function (){


                var $pkId=${pkId};
                $.ajax({
                    type:"post",
                    url:"/updateByIdClassroom",
                    data:JSON.stringify({"pkId":$pkId}),
                    dataType:"json",
                    contentType: "application/json;charset=UTF-8",//指定消息请求类型
                    success:function(m){


                        $("#area").val(m.an.area);
                        $("#buildingNo").val(m.an.buildingNo);
                        $("#buildingFloor").val(m.an.buildingFloor);
                        $("#classroomId").val(m.an.classroomId);
                        $("#classroomName").val(m.an.classroomName);
                        $("#galleryful").val(m.an.galleryful);

                    },
                    error:function(e){
                        alert("classroom回显请求错误");
                    }


                })
            })


        </script>








    </div> <%--layui-body内容的div--%>




    <div class="layui-footer">
        <!-- 底部固定区域 -->
        底部固定区域
    </div>
</div>
<script th:src="@{/libs/layui/layui.js}"></script>

</body>
</html>
